/*import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    login: '',
    apiKey: localStorage.getItem('apikey'),
    titles: '',
    isAudit: '',  //是否是审计账户
    isCollapse: false, // 菜单展开缩放
    visitedViews: []
  },
  mutations: {
    login(state, data) {
      state.login = data;
    },
    setApi(state, data) {
      state.apiKey = data;
    },
    setHeaderTitle(state, data) {
      state.titles = data;
    },
    //是否是审计账户
    fnAudit(state, data) {
      state.isAudit = data;
    },
    /!*
    * @desc 菜单展开缩放
    * *!/
    fnCollapse(state){
      state.isCollapse = !state.isCollapse
    },

    /!*
    * @desc tagview数组
    * *!/
    addVisitedView(state, arr){
      state.visitedViews = arr
    },

    /!*
    * @desc tagview数组删除
    * *!/
    delVisitedView(state, arr){
      state.visitedViews = arr
    },
  },
  actions: {
  },
  modules: {
  }
})*/
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import getters from './getters'
import mutations from './mutations'
import actions from './actions'

Vue.use(Vuex)

const modulesFiles = require.context('./modules', true, /\.js$/)

const modules = modulesFiles.keys().reduce((modules, modulePath) => {
  const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
  const value = modulesFiles(modulePath)
  modules[moduleName] = value.default
  return modules
}, {})

const store = new Vuex.Store({
  modules,
  state,
  getters,
  mutations,
  actions
})

export default store
